import static org.junit.Assert.*;
import java.util.Random;
import org.junit.Before;
import org.junit.Test;

public class sortTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void test() {
		// Declare variables
		// 1,000 = 8ms
		// 10,000 = 259ms
		// 100,000 = 25,834ms
		int quantity = 10000;
		int maxNbr = 100 * quantity;
		int[] nbrHolder = new int[quantity];
		int i, j;
		Random randGen = new Random();

		// Generate random numbers btwn 1 - "quantity"
		for (i = 0; i < nbrHolder.length; i++) {
			nbrHolder[i] = randGen.nextInt(maxNbr);
		}

		// Call sort method and send nbrHolder[];
		Sort g = new Sort();
		long start = System.currentTimeMillis(); // Start clock
		int[] nbrHolderSorted = g.sort(nbrHolder);
		long stop = System.currentTimeMillis();  // Stop clock
		System.out.println(stop - start);		// Print duration
		
		// Test if numbers are sorted
		for (i = 0, j = 1; j < nbrHolderSorted.length; i++, j++) {
			assertTrue(nbrHolderSorted[i] <= nbrHolderSorted[j]);
		}

	}

}
